package test.classloader;

import java.lang.reflect.Field;
import java.net.URL;
import java.net.URLClassLoader;

public class LoaderSample2
{
	public static void main(String[] args)
	{
		try {
            //String path = System.getProperty("user.dir");
            URL[] us = {new URL("file:e:/testlib/mysqlconnectorjava508bin.jar")};
            ClassLoader loader = new URLClassLoader(us);
            Class c = loader.loadClass("uRLClassLoaderTest1.LoaderSample3");
            System.out.println(LoaderSample2.class.getClassLoader());//
            Object o = c.newInstance();
            Field f = c.getField("age");
            int age = f.getInt(o);
            System.out.println("age is " + age);
        } catch (Exception e) {
            e.printStackTrace();
        }
	}
}
